import Vue from "vue";
import Router from "vue-router";
import Layout from "../layout/index";

Vue.use(Router);

export const constantRouterMap = [
  {
    path: "/login",
    meta: { title: "登录", noCache: true },
    component: resolve => require(["@/views/login"], resolve),
    hidden: true
  },
  {
    path: "/404",
    component: resolve => require(["@/views/features/404"], resolve),
    hidden: true
  },
  {
    path: "/401",
    component: resolve => require(["@/views/features/401"], resolve),
    hidden: true
  },
  {
    path: "/redirect",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "/redirect/:path*",
        component: resolve => require(["@/views/features/redirect"], resolve)
      }
    ]
  },
  {
    path: "/",
    component: Layout,
    redirect: "/dashboard",
    name: "首页",
    icon: "index",
    status: 1,
    children: [
      {
        path: "dashboard",
        component: resolve => require(["@/views/home"], resolve),
        name: "Dashboard",
        meta: { title: "首页", icon: "index", affix: true, noCache: true }
      },
      {
        path: "patient",
        component: resolve => require(["@/views/doctor/Patient"], resolve),
        name: "患者列表",
        meta: { title: "患者列表" }
      },
      {
        path: "consult",
        component: resolve =>
          require(["@/views/doctor/MedicalConsultation"], resolve),
        name: "在线问诊",
        meta: { title: "在线问诊" }
      },
      {
        path: "check",
        component: resolve => require(["@/views/doctor/CheckPresc"], resolve),
        name: "处方审核",
        meta: { title: "处方审核" }
      },
      {
        path: "prescDetail",
        component: resolve => require(["@/views/doctor/PrescDetail"], resolve),
        name: "处方详情",
        meta: { title: "处方详情" }
      },
       {
        path: "orderTemp",
        component: resolve => require(["@/views/doctor/orderTemp"], resolve),
        name: "医嘱模版",
        meta: { title: "医嘱模版" }
      },
       {
        path: "diagTemp",
        component: resolve => require(["@/views/doctor/diagnosisTemp"], resolve),
        name: "诊断模版",
        meta: { title: "诊断模版" }
      },
      {
        path: "systemMenu",
        component: resolve => require(["@/views/system/menu/index"], resolve),
        name: "系统菜单",
        meta: { title: "系统菜单" }
      },
      {
        path: "nursingManage",
        component: resolve =>
          require(["@/views/nursing/NursingManage"], resolve),
        name: "护理项目",
        meta: { title: "护理项目" }
      },
      {
        path: "nursingIndex",
        component: resolve => require(["@/views/nursing/index"], resolve),
        name: "护理护士",
        meta: { title: "护理护士" }
      },
      {
        path: "nursingTagManage",
        component: resolve => require(["@/views/nursing/tagManage"], resolve),
        name: "护士标签",
        meta: { title: "护士标签" }
      },
      {
        path: "menuManage",
        component: resolve => require(["@/views/menus/index"], resolve),
        name: "功能菜单",
        meta: { title: "功能菜单" }
      },
      {
        path: "feedBack",
        component: resolve => require(["@/views/feedBack/index"], resolve),
        name: "留言反馈",
        meta: { title: "留言反馈" }
      },
      {
        path: "nursingQuestion",
        component: resolve =>
          require(["@/views/nursing/NursingQuestion"], resolve),
        name: "护理问卷",
        meta: { title: "护理问卷" }
      }
    ]
  },
  {
    path: "/user",
    component: Layout,
    hidden: true,
    redirect: "noredirect",
    children: [
      {
        path: "center",
        component: resolve => require(["@/views/system/user/center"], resolve),
        name: "个人中心",
        meta: { title: "个人中心" }
      }
    ]
  }
];

export default new Router({
  mode: "history",
  base: "/wxappm/",
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
});
